package com.controller.zy;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.entity.ProductClassify;
import com.service.zy.ProductClassifyService;

@Controller
public class ProductClassifyController {
	@Autowired
	private ProductClassifyService productclassifyService;
	
	@RequestMapping("/classifyList")
	@ResponseBody
	public List<ProductClassify> getAll(){
		return productclassifyService.findAll();
	}
	
	@RequestMapping("/addClassify")
	public void add(@RequestBody ProductClassify pc) {
		System.out.println("节点名称："+pc.getName()+"父级"+pc.getSuperid());
		productclassifyService.add(pc);
	}
	
	@RequestMapping("/delClassify")
	public void delete(Long id) {
		productclassifyService.delOne(id);
	}
	
	@RequestMapping("/changeClassify")
	public void change(@RequestBody ProductClassify pc) {
		System.out.println("id值"+pc.getClassifyId()+"值："+pc.getName());
		productclassifyService.add(pc);
	}
}
